<template>
  <el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情' : '编辑'" :close-on-click-modal="false" :visible.sync="visible" class="cu-dialog cu-dialog_center" lock-scroll width="1000px">
    <el-row :gutter="15" class="">
      <el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" :disabled="!!isDetail" :rules="rules">
        <el-col :span="12">
          <el-form-item label="收款品牌" prop="brand">
            <el-select v-model="dataForm.brand" placeholder="请选择收款品牌" clearable required :style="{ width: '100%' }">
              <el-option v-for="(item, index) in brandOptions" :key="index" :label="item.fullName" :value="item.enCode"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12" v-if="!isEdit || (isEdit && !!dataForm.campusId)">
          <el-form-item label="收款校区" prop="campusId" v-bind:required="dataForm.type === '2'">
            <el-select v-model="dataForm.campusId" placeholder="请选择" @change="handleChangeCampus" filterable clearable required :style="{ width: '100%' }" :loading="campusLoading" @focus="loadCampusOptions">
              <el-option v-for="item in campusOptions" :key="item.id" :label="item.fullName" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12" v-else>
          <el-form-item label="意向学校" prop="campusName">
            <el-input v-model="dataForm.campusName" placeholder="请输入客户名称" clearable required :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="客户名称" prop="name">
            <el-input v-model="dataForm.name" placeholder="请输入客户名称" clearable required :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="所属区域" :prop="'area'" v-bind:required="dataForm.type === '3'">
            <custom-address v-model="dataForm.area" placeholder="请选择所在地区" :multiple="false" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="收款方式" prop="method">
            <el-select v-model="dataForm.method" placeholder="请选择收款方式" clearable required :style="{ width: '100%' }">
              <el-option v-for="(item, index) in methodOptions" :key="index" :label="item.fullName" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="收款金额" prop="amount">
            <el-input v-model="dataForm.amount" placeholder="请输入收款金额" clearable required :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="收款时间" prop="time">
            <el-date-picker v-model="dataForm.time" placeholder="请选择收款时间" clearable required :style="{ width: '100%' }" type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="timestamp"></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="收款类型" prop="type">
            <el-radio-group v-model="dataForm.type" required :style="{}">
              <el-radio v-for="(item, index) in typeOptions" :key="index" :label="item.id">{{ item.fullName }}</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="加盟政策" prop="policy">
            <el-input v-model="dataForm.policy" placeholder="请输入加盟政策" clearable required :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="是否完款" prop="isFinish">
            <el-switch v-model="dataForm.isFinish" :active-value="true" :inactive-value="false"></el-switch>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="收款类别" prop="status">
            <el-radio-group v-model="dataForm.status" required :style="{}">
              <el-radio v-for="(item, index) in statusOptions" :key="index" :label="item.id">{{ item.fullName }}</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="对接人" prop="managerId">
            <user-select v-model="dataForm.managerId" placeholder="请选择" clearable required :style="{ width: '50%' }"></user-select>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="备注" prop="description">
            <el-input v-model="dataForm.description" placeholder="请输入" show-word-limit :style="{ width: '100%' }" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }"></el-input>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取 消</el-button>
      <el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail">确 定</el-button>
    </span>
  </el-dialog>
</template>
<script>
export { default } from './index.js'
</script>
<style scoped>
.el-time-spinner__wrapper {
  width: 100% !important;
}
@import url(index.scss);
</style>
